import { ApiProperty } from '@nestjs/swagger'
import { IsString, IsNotEmpty, IsNumber, IsBoolean } from 'class-validator'

export class CreateMenuDto {
  @ApiProperty({ description: '名称' })
  @IsString({ message: '不是有效数据' })
  @IsNotEmpty({ message: '名称不能为空' })
  readonly name: string

  @ApiProperty({ description: '标题,可填写中文，如果多语言请填locals路径' })
  @IsString({ message: '不是有效数据' })
  @IsNotEmpty({ message: '标题不能为空' })
  readonly title: string

  @ApiProperty({ description: '' })
  @IsNumber()
  readonly pid: number

  @ApiProperty({ description: '' })
  @IsString({ message: '不是有效数据' })
  readonly icon: string

  @ApiProperty({ description: '' })
  @IsString({ message: '不是有效数据' })
  readonly path: string

  @ApiProperty({ description: '' })
  readonly component: string

  @ApiProperty({ description: '' })
  readonly roles: string

  @ApiProperty({ description: '' })
  readonly redirect: string

  @ApiProperty({ description: '', default: false })
  @IsBoolean()
  readonly affix: boolean
}
